﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using RenAi.Medical.Model;

namespace RenAi.Medical.DAL
{
    public class ParticularDAL
    {
        /// <summary>
        /// 显示就医指南信息
        /// </summary>
        /// <returns></returns>
        public DataTable GetParticular()
        {
            string sql = "select Particular_Id,Particular_Name,FingerpostType_Id from Particular";
            return DBhelper.GetTable(sql);
        }
        /// <summary>
        /// 删除就医指南信息
        /// </summary>
        /// <param name="Particular_Id"></param>
        /// <returns></returns>
        public int DeleteParticular(string Particular_Id)
        {
            int i = DBhelper.NonQuery(string.Format("delete from Particular where Particular_Id='{0}'", Particular_Id));
            return i;
        }
        /// <summary>
        /// 根据编号找到就医指南信息
        /// </summary>
        /// <param name="Particular_Id"></param>
        /// <returns></returns>
        public DataTable GeParticular(string Particular_Id)
        { 
            DataTable dt =DBhelper.GetTable(string .Format("select * from Particular where Particular_Id='{0}'",Particular_Id));
            return dt;
        }
        /// <summary>
        /// 修改就医指南信息
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public int UpdateParticular(Particular p)
        {
            int i = DBhelper.NonQuery(string.Format("update Particular set Particular_Name='{0}',FingerpostType_Id='{1}' where Particular_Id='{2}'",p.Particular_Name,p.FingerpostType_Id,p.Particular_Id));
            return i;        
        }

    }
}
